Skip to content

build: the war on config.h is a war of attrition, 2 of ∞ #18877

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
May 27, 2025

Conversation

eqvinox
Copy link
Contributor

@eqvinox eqvinox commented May 23, 2025

Another stack of config.h related cleanups.

On the TODO list of things needed for using our headers without config.h (#18807):

  • HAVE_CLOCK_THREAD_CPUTIME_ID needs to go (because it changes the layout of struct event)
    • easy, because it's set on all of our supported platforms. It's only missing on Apple, which is a pandora's box for another day…
  • HAVE_SECTION_SYMS might affect things
    • easy again, because it's set on all of our supported platforms. This one was for Solaris primarily (and Apple is screwed regardless, being a non-ELF platform)
  • HAVE_MALLOC_USABLE_SIZE & HAVE_MALLOC_SIZE need something, because they affect the layout of struct mtype
  • MULTIPATH_NUM will just need to be exported in the .pc file, i.e. it'll have -DMULTIPATH_NUM=1234
  • needs investigation: HAVE_NETLINK (struct layouts?)
  • needs investigation: HAVE_RTADV (struct layouts again)
  • needs investigation: HAVE_BFDD (conditionals in zebra?)

The other #if checks should be "benign", as in, shouldn't break anything if they're just not set.

eqvinox added 6 commits May 23, 2025 16:43
Oops, there were two and I only killed one in 9ff7885.  Zap the
other one too.

And while we're at it, that means `ND6_INFINITE_LIFETIME` is no longer
needed either.

Signed-off-by: David Lamparter <[email protected]>
`struct in6_aliasreq` exists on all of the BSDs, no point in testing for
it really.  Just use it and that's that then.

Signed-off-by: David Lamparter <[email protected]>
`netinet6/in6_var.h` exists on all of the BSDs, and more than that it's
only needed in `zebra/ioctl.c` and nowhere else.

Drop the check & global `zebra.h` reference, and just include it where
it's actually used.

Signed-off-by: David Lamparter <[email protected]>
If you've looked at the commits before this, you'll know the drill:
this file exists on all BSDs, so it's pointless to check.  It's also
only used in 3 files, so include it there.

Except for some reason there was an `#include <linux/types.h>` tied into
this, which is incredibly strange.  The check was triggering on *some*
of the Linux systems in CI (because old Linux has a sys/sysctl.h), but
not all...  so it should be safe to remove.  Let's just see if it blows
up.

Signed-off-by: David Lamparter <[email protected]>
This one is extra funny because `configure.ac` has a comment explaining
why it's needed.  Except that comment is either wrong or outdated...
`net/if_var.h` doesn't exist on NetBSD, is semantically empty on
OpenBSD, and contains nothing of relevance on FreeBSD.

Ditch and move on.

Signed-off-by: David Lamparter <[email protected]>
Neither of these two include files is needed anywhere.  Ditch the
autoconf checks and global `lib/zebra.h` reference.

Signed-off-by: David Lamparter <[email protected]>
@donaldsharp
Copy link
Member

Once CI finishes I'll get this in.....

eqvinox added 2 commits May 24, 2025 07:35
`net/if_dl.h` exists on all BSDs and is used for all link-level
interface address bits there.  Remove the autoconf check, and gate it by
`!__linux__` instead, and include it where needed rather than in
`lib/zebra.h`.

(Note there are some other CMSG related macros that implicitly need it,
that's why it's in the _packet.c files even though they have no direct
sockaddr_dl reference.)

Signed-off-by: David Lamparter <[email protected]>
At least in `.h` files, use `__linux__` (defined by the compilers)
rather than `GNU_LINUX` (from our autoconf).  It doesn't matter much for
`.c` files, but for `.h` it's the difference between them being
externally usable without our autoconf foo or not.

Signed-off-by: David Lamparter <[email protected]>
@eqvinox eqvinox force-pushed the build-config-h-20250523 branch from eee3b7f to 40b5660 Compare May 24, 2025 05:37
@vjardin
Copy link
Contributor

vjardin commented May 25, 2025

LGTM, including yesterday's updates after @donaldsharp 's review.

@Jafaral Jafaral merged commit 1eb4112 into FRRouting:master May 27, 2025
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants